import request from '@/utils/request'

// 查询排班表
export function searchScheduleList(phone,name,page,size) {
  return request({
    url: '/driver/api/v1/schedule/list',
    method: 'post',
    params:{
      phone:phone,
      name:name,
      page:page,
      size:size,
    }
  })
}

export function searchScheduleByToken() {
  return request({
    url: '/driver/api/v1/schedule/searchScheduleByToken',
    method: 'get',
  })
}

export function newAttendance() {
  return request({
    url: '/driver/api/v1/schedule/newAttendance',
    method: 'post',
  })
}

// 查询未排班人员
selectNoScheduleDriverList
export function selectNoScheduleDriverList() {
    return request({
      url: '/driver/api/v1/schedule/driver',
      method: 'get'
    })
  }

  export function addSchedule(noScheduleDriverId, nameAndPhone) {
    return request({
      url: '/driver/api/v1/schedule/add',
      method: 'post',
      data: {
        noScheduleDriverId: noScheduleDriverId,
        nameAndPhone: nameAndPhone
      }
    });
  }
  
  export function getScheduleById(id) {
    return request({
      url: '/driver/api/v1/schedule/getScheduleById',
      method: 'get',
      params:{
        id:id
      }
    })
  }

  export function updateScheduleById(form) {
    return request({
      url: '/driver/api/v1/schedule/updateScheduleById',
      method: 'post',
      data: form
    });
  }

  export function newDriverLeave(leaveDate, leaveRemark) {
    return request({
      url: '/driver/api/v1/leave/newDriverLeave',
      method: 'post',
      params:{
        leaveDate:leaveDate,
        leaveRemark:leaveRemark,
      }
    });
  }

  export function searchLeaveList(page,size) {
    return request({
      url: '/driver/api/v1/leave/searchLeaveList',
      method: 'post',
      params:{
        page:page,
        size:size,
      }
    })
  }


export function agreeLeave(id) {
  return request({
    url: '/driver/api/v1/leave/agreeLeave',
    params: {
      id: id
    },
    method: 'post'
  })
}

export function notAgreeLeave(id) {
  return request({
    url: '/driver/api/v1/leave/notAgreeLeave',
    params: {
      id: id
    },
    method: 'post'
  })
}